package com.tanhua.dubbo.api;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tanhua.dubbo.mapper.SettingsMapper;
import com.tanhua.model.db.Settings;
import com.tanhua.model.vo.SettingsVo;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @auther : 白月尘
 * @date : 13:27  2021/10/18
 */
@DubboService
public class SettingsApiImpl implements SettingsApi{
    @Autowired
    private SettingsMapper settingsMapper;

    @Override
    public Settings findByUserId(long userId) {
        QueryWrapper<Settings> queryWrapper=new QueryWrapper();
        queryWrapper.eq("user_id",userId);
        return settingsMapper.selectOne(queryWrapper);
    }

    @Override
    public void save(Settings settings) {
        settingsMapper.insert(settings);
    }

    @Override
    public void update(Settings settings) {
        settingsMapper.updateById(settings);
    }
}
